<?php
namespace app\wap\controller;

use app\BaseController;
use think\facade\View;

// 学习 socketio 通讯
class Socketio extends BaseController
{

    // 点对点
    // http://127.0.0.3/index.php/wap/socketio/index/from/小王/to/小刘
    public function index(){
        $my_id = input('param.from') ?: '小王';
        $to_id = input('param.to')   ?: '小刘';

        View::assign('my_id', $my_id);
        View::assign('to_id', $to_id);
        View::assign('group_name', $my_id . $to_id . '聊天室');
        return view();
    }

    // 群聊
    public function group(){
        $group_id = input('param.group_id') ?: 1;

        View::assign('group_id', $group_id);
        View::assign('group_name', '第' . $group_id . '聊天室');
        return view();
    }

}